//
//  NSString+FilePath.m
//  SanFangLianKong
//
//  Created by x on 2017/4/1.
//  Copyright © 2017年 zhaidanhui. All rights reserved.
//

#import "NSString+FilePath.h"

@implementation NSString (FilePath)

+ (NSString *)CachesDir:(NSString *)file{
    
    NSString *cachesDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
    NSString *filePath = [cachesDir stringByAppendingPathComponent:[file lastPathComponent]];
    return filePath;
}

+ (NSString *)DocumentDir:(NSString *)file{
    
    NSString *documentDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true) firstObject];
    NSString *filePath = [documentDir stringByAppendingPathComponent:[file lastPathComponent]];
    return filePath;
}

+ (NSString *)LibraryDir:(NSString *)file{
    
    NSString *libraryDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) firstObject];
    NSString *filePath = [libraryDir stringByAppendingPathComponent:[file lastPathComponent]];
    return filePath;
}

+ (NSString *)TempDir:(NSString *)file{
    NSString *tempDir = NSTemporaryDirectory();
    NSString *filePath = [tempDir stringByAppendingPathComponent:[file lastPathComponent]];
    return filePath;
}

@end
